package com.zhang.designmode.wangzheng_design_mode.T44_Factory.simpleFactory;

/**
 * @Author: zxz
 * @DateTime: 2022/3/1 11:26
 * @Description: 车的工厂类
 */
public class CarFactory {
    ICar createCar(Class<? extends ICar> clazz){
        if (clazz !=null){
            try {
                return clazz.newInstance();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}
